<?php
class Carry_log_model extends BZ_Model
{
    protected $table   = 'order_base';
    protected $table_2 = 'order_take_cash';
	
    public function total($search_param=array())
    {
        $this->db->from($this->table.' as order_base');
        $this->db->join($this->table_2.' as order_take_cash', 'order_take_cash.order_id = order_base.order_id');
        if (!empty($search_param['uid'])) {
            $this->db->where('order_base.payer_uid', $search_param['uid']);
        }
        $this->db->where('order_base.cat_id', 512);//提现
        $this->db->where('(order_base.bit_pay & 65536) =', 65536);
        return $this->db->count_all_results();
    }
    
    public function page_list($page_num, $num, $search_param=array())
    {
        $this->db->select('order_base.order_id,order_base.amount_total,order_base.ordertime,order_take_cash.bit_au,order_take_cash.msg');
        $this->db->from($this->table.' as order_base');
        $this->db->join($this->table_2.' as order_take_cash', 'order_take_cash.order_id = order_base.order_id');
        if (!empty($search_param['uid']))  {
            $this->db->where('order_base.payer_uid', $search_param['uid']);
        }
        $this->db->where('order_base.cat_id', 512);//提现
        $this->db->where('(order_base.bit_pay & 65536) =', 65536);
        $this->db->order_by('order_base.order_id', 'desc');
        $this->db->limit($page_num, $num);
        return $this->db->get();
    }
}